home *** CD-ROM | disk | FTP | other *** search
/ PC Open 100 / PC Open 100 CD 1.bin / CD1 / INTERNET / WEBDESIGN / Tsw WebCoder / tswwebcoder5en.exe / {app} / data / tools / dialog_select.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-05-18  |  5.7 KB  |  108 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <dialog width="430" height="300" caption="List">
  3.     <controls>
  4.         <panel name="mainpanel" caption="" align="alclient" bevelinner="bvnone" bevelouter="bvnone">
  5.             <label name="lblName" caption="Name" hint="The name of this element. Important if you wish to refer to this form element through some sort of scripting for instance. This field is required." width="29" height="13" top="8" left="8"/>
  6.             <label name="lblOptions" caption="Number of options" hint="Decide how many options WebCoder should generate for you. You can add more later, by your self." width="121" height="13" top="8" left="208"/>
  7.             <label name="lblSize" caption="Size" hint="Choose the size of your list. If it's below one, it will be shown as a dropdown list. Otherwise it will be shown as a stardard list of options." width="52" height="13" top="56" left="208"/>
  8.             <edit name="edtName" taborder="0" text="" hint="The name of this element. Important if you wish to refer to this form element through some sort of scripting for instance. This field is required." width="175" height="19" top="24" left="8"/>
  9.             <spinedit name="speOptions" taborder="1" hint="Decide how many options WebCoder should generate for you. You can add more later, by your self." maxvalue="0" minvalue="0" value="0" width="175" height="20" top="24" left="208"/>
  10.             <checkbox name="cbDisabled" caption="Disabled" taborder="2" hint="Your element will be visible, but disabled." checked="0" width="121" height="17" top="56" left="8"/>
  11.             <checkbox name="cbMultiple" caption="Multiple choices" taborder="3" hint="Let the user make more than one choice on the list, using the Ctrl and Shift + mouse click." checked="0" width="137" height="17" top="72" left="8"/>
  12.             <spinedit name="speSize" taborder="4" hint="Choose the size of your list. If it's below one, it will be shown as a dropdown list. Otherwise it will be shown as a stardard list of options." maxvalue="0" minvalue="0" value="0" width="121" height="20" top="72" left="208"/>
  13.             <checkbox name="cbEndOptionTags" caption="Insert </option> tags" taborder="6" hint="Inserts ending </option> tags. Required in e.g. XHTML." checked="0" width="137" height="17" top="88" left="8"/>
  14.         </panel>
  15.     </controls>
  16.     <dialogevents>
  17.         <event type="onclose" resulttype="ok">
  18.  
  19.             StartCode := ('<select');
  20.             if edtName.Text <> '' then
  21.              StartCode := StartCode + (' name="'+(edtName.Text)+'"');
  22.             if speSize.Value > 0 then
  23.              StartCode := StartCode + (' size="'+(IntToStr(speSize.Value))+'"');
  24.             if cbDisabled.Checked then
  25.              StartCode := StartCode + (' disabled');
  26.             if cbMultiple.Checked then
  27.              StartCode := StartCode + (' multiple');
  28.  
  29.               If edtCSSClass.Text <> '' then
  30.              StartCode := StartCode + ' class="'+edtCSSClass.Text+'"';
  31.               If edtCSSId.Text <> '' then
  32.                StartCode := StartCode + ' ID="'+edtCSSId.Text+'"';
  33.               If edtCSSStyle.Text <> '' then
  34.                StartCode := StartCode + ' style="'+edtCSSStyle.Text+'"';
  35.             for i := 0 to EventGrid.Count - 1 do
  36.               begin
  37.               if EventGrid.Rows[i].EditText <> '' then
  38.                StartCode := StartCode + ' ' + (EventGrid.Rows[i].Caption+'="' + EventGrid.Rows[i].EditText)+'"';
  39.              end;
  40.             StartCode := StartCode + '>';
  41.                EndCode := '';            
  42.             if speOptions.Value > 0 then
  43.              begin
  44.               for i:=0 to speOptions.Value-1 do
  45.                begin
  46.                 Temp := '<option>';
  47.                 If cbEndOptionTags.Checked then
  48.                  Temp := Temp+'</option>';
  49.                 EndCode := EndCode + #9+Temp+#13#10;
  50.                end;
  51.               EndCode := #13#10+EndCode; 
  52.              end;
  53.             EndCode := EndCode+'</select>';
  54.             If cbMakeXHTMLCompliant.Checked then
  55.              StartCode := MakeXHTMLCompliant(StartCode, true);
  56.             If cbDoPHPEscape.Checked then
  57.              StartCode := DoPHPEscape(StartCode);
  58.             // A little "hack" - WebCoder will set this, to let us know whether to update
  59.             // an existing tag, or insert a brand new one
  60.             If cbUpdateExistingTag.Checked then
  61.              ReplaceTag(StartCode)
  62.             else
  63.                InsertTags(StartCode+EndCode, '');
  64.  
  65.         </event>
  66.         <event type="onshow">
  67.             // Lets put the advanced panel in the right place
  68.             pnlAdvanced.Parent := MainPanel;
  69.             pnlAdvanced.Left := 8;
  70.             pnlAdvanced.Top := MainPanel.Height - 32;
  71.             pnlAdvanced.Width := Self.Width - 36;
  72.             // Height of the panel will be set internally. Do we need to make the dialog higher to make room for the Advanced panel?
  73.             If pnlAdvanced.Height > 20 then
  74.              Self.Height := Self.Height + 200;
  75.         </event>
  76.         <event type="updatedialog">
  77.             // This event will be called when a user executes the "Edit current tag"-rightclick feature
  78.             // The entire selected tag will be passed as a parameter to this function, that should update
  79.             // the required fields of the dialog.
  80.             function UpdateDialog(Tag: string);
  81.              begin
  82.               
  83.               cbEndOptionTags.Enabled := false;
  84.               speOptions.Enabled := false;
  85.                   
  86.               edtName.Text := GetValueFromAttribute(Tag, 'name');
  87.               Size := GetValueFromAttribute(Tag, 'size');
  88.               If Size <> '' then
  89.                speSize.Value := StrToInt(Size);
  90.               cbDisabled.Checked := HasOption(Tag, 'disabled');
  91.               cbMultiple.Checked := HasOption(Tag, 'multiple');
  92.  
  93.                 edtCSSClass.Text := GetValueFromAttribute(Tag, 'class');
  94.                 edtCSSId.Text := GetValueFromAttribute(Tag, 'id');
  95.                 edtCSSStyle.Text := GetValueFromAttribute(Tag, 'style');
  96.               for i := 0 to EventGrid.Count - 1 do
  97.                 begin
  98.                  EventVal := GetValueFromAttribute(Tag, Lowercase(EventGrid.Rows[i].Caption));
  99.                  If EventVal <> '' then
  100.                   EventGrid.Rows[i].EditText := EventVal;
  101.                end;
  102.               cbDoPHPEscape.Checked := IsPHPEscaped(Tag);
  103.               cbMakeXHTMLCompliant.Checked := isXHTMLDocument();
  104.              end;
  105.         </event>
  106.     </dialogevents>
  107. </dialog>
  108.